<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>自媒体列表·思通投研·让数据驱动投资价值!</title>
	<link href="${pageContext.request.contextPath }/img/webLogoIcon.png" rel="shortcut icon">
    <link href="${pageContext.request.contextPath }/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/font-awesome.css" rel="stylesheet">

    <link href="${pageContext.request.contextPath }/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/style.css" rel="stylesheet">
    

	<link href="${pageContext.request.contextPath }/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">

    <!-- FooTable -->
    <link href="${pageContext.request.contextPath }/css/footable.core.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/datepicker3.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/mypage.css" rel="stylesheet">
    <style>
		.select2_demo_1{
			float: left;
			width: 120px;
			display: inline;
			margin-left: 10px;
		}
		.form-control{
			display: inline;
		}
		
		.col-sm-3{
			float:right;
			width: 560px;
		}
		.input-group{
			float:right;
			width: 240px;
			margin-left: 5px;
		}
	   td{
	        vertical-align:middle;
	    }
	    .select::after{
	    	content: '';
	    	display: block;
	    	clear: both;
	    }
	    .select{
	    	width: 100%;
	    	min-height: 20px;
	    	padding: 10px;
	    	background: #fff;
	    }
	    .select select{
	    	display: inline-block;
	    	float: left;
	    	margin-right: 20px;
    	    width: 120px;
	    }
	    .select button {
		float: left;
		}
		.select-text{
			background-color: #FFFFFF;
		    background-image: none;
		    border: 1px solid #e5e6e7;
		    border-radius: 1px;
		    color: inherit;
		    display: block;
		    padding: 6px 12px;
		    font-size: 14px;
		}
	</style>

</head>

<body>

    <div id="wrapper">

        <nav class="navbar-default navbar-static-side" role="navigation">
            <%request.setAttribute("LEFT", "wemedialist");%>
			<%@include file="left-factory.jsp"%>
        </nav>

        <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
         <jsp:include page="head-factory.jsp" flush="true" /> 
        </div>
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-9">
                <h2>自媒体列表</h2>
                <ol class="breadcrumb">
                	<li class="nav-main1">
                		<a href="${pageContext.request.contextPath}/admin/tosystem_overview">主页</a>
                	</li>
                	<li class="nav-main2" >
                			<a id="navigation1" href="#" >客户端</a>
                	</li>
                	<li class="active">
                		<a >自媒体列表页</a>
                	</li>
                </ol>
            </div>
        </div>

        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                    <div class="select">
                    	<select class="form-control" id="websiz" onchange="seek(1)">
                    	<option value="" selected="selected">全部平台</option>
                    	<c:forEach items="${form }" var="form">
	                    	<option value="${form.id}">${form.platform_name}</option>
                    	</c:forEach>
                    	</select>
                    	<input class="select-text" value="${website_name}" id="website_name" placeholder="自媒体名称">
						
                    	<button class="btn btn-primary" onclick="seek(1)">搜索</button>
                    </div>
                        <div class="ibox-content">
<!--                         	<div class="btn btn-primary pull-left">以下是昨日未采集到数据的种子信息</div> -->

                
                        	
                        	
            
                
               
	            
	            <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="25"><!-- data-page-size="25" -->
                                <thead>
                                <tr>
                                    <th style="width: 15%;">作者</th>
                                    <th style="width: 10%;">来源平台</th>
                                    <th style="width: 10%;">发表数</th>
                                    <th style="width: 10%;">关注数</th>
                                    <th style="width: 10%;">阅读数</th>
                                    <th style="width: 10%;">自媒体等级</th>
                                    <th style="width: 10%;">说明</th>
                                </tr>
                                </thead>
                                <tbody id = "tbody">
                                <c:forEach items="${list.list }" var="web">
	                              	<tr>
	                              		
	                              		
	                              		
	                              		<td><a onclick="help('${web.home_page_url}')">${web.name}</a></td>
	                              		
	                              		
	                              		<c:if test="${web.platform_name eq null || empty web.platform_name}">
	                              		<td>空</td>
	                              		</c:if>
	                              		<c:if test="${not empty web.platform_name && !(web.platform_name eq null) }">
	                              		<td>${web.platform_name}</td>
	                              		</c:if>
	                              		<c:if test="${web.production_count==null}">
	                              			<td>0</td>
	                              		</c:if>
	                              		<c:if test="${web.production_count!=null}">
	                              			<td>${web.production_count}</td>
	                              		</c:if>
	                              		
	                              		<c:if test="${web.focus_count==null}">
	                              			<td>0</td>
	                              		</c:if>
	                              		<c:if test="${web.focus_count!=null}">
	                              			<td>${web.focus_count}</td>
	                              		</c:if>
	                              		
	                              		
	                              		<c:if test="${web.reader_count==null}">
	                              			<td>0</td>
	                              		</c:if>
	                              		<c:if test="${web.reader_count!=null}">
	                              			<td>${web.reader_count}</td>
	                              		</c:if>
	                              		
	                              		
	                              		<c:if test="${web.spider_level==null}">
	                              			<td>空</td>
	                              		</c:if>
	                              		<c:if test="${web.spider_level!=null}">
	                              			<td>${web.spider_level}</td>
	                              		</c:if>
	                              		
	                              		
	                              		
	                              		
	                              		<c:if test="${web.certification_instructions==null}">
	                              			<td>空</td>
	                              		</c:if>
	                              		<c:if test="${web.certification_instructions!=null}">
	                              			<td>${web.certification_instructions}</td>
	                              		</c:if>
	                              		
	                              	</tr>
                              	</c:forEach>
                                </tbody>
                                <tfoot>
                                <tr>
                                    <td colspan="6">
                                        <c:if test="${list.pages>0}">
											<div class="box" id="box" style="float: right;"></div>
										</c:if>
                                    </td>
                                </tr>
                                </tfoot>
                            </table>

                        </div>
                    </div>
                </div>
        </div>
        </div>
<jsp:include page="footer.jsp" flush="true" />
        </div>
        </div>


    <!-- Mainly scripts -->
    <script src="${pageContext.request.contextPath }/js/jquery-2.1.1.js"></script>
    <script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath }/js/jquery.metisMenu.js"></script>
    <script src="${pageContext.request.contextPath }/js/jquery.slimscroll.min.js"></script>

    <!-- Custom and plugin javascript -->
    <script src="${pageContext.request.contextPath }/js/inspinia.js"></script>
    <script src="${pageContext.request.contextPath }/js/pace.min.js"></script>
    


    <!-- FooTable -->
    <script src="${pageContext.request.contextPath }/js/footable.all.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/mypage.js"></script>
    
    <script src="${pageContext.request.contextPath }/js/plugins/toastr/toastr.min.js"></script>
	<!-- Sweet alert -->
	<script src="${pageContext.request.contextPath }/js/plugins/sweetalert/sweetalert.min.js"></script>
	
    <!-- Page-Level Scripts -->
    <script>
    function help(url){
    	window.open(url);
    }
    function seek(PageNo){
			var website_name=document.getElementById("website_name").value;
			var websiz=document.getElementById("websiz").value;
			$.ajax({
				type : 'post',
				url : "${basePath}/spider-factory/wemedialist/screen",
				data : {
					website_name:website_name,
					websiz:websiz,
					PageNo:PageNo
					},
				dateType:"json",
				success:function(res){
					
					groupList(res)
				},
				error:function(err){
					
				}
				
			});
			}
    
    // 组装数据列表
    function groupList(res) {
 	   let listStr1 = '';
 	   let arrObj = res.page.list;
 	   let pagehelp=res.page;
 	  let totalCount= pagehelp.total;
	 	let pageNum= pagehelp.pageNum;
	 	let pageCount= pagehelp.pages;
	 	if(pageCount>500){
			   pageCount = 500;
			}
	 	paging(totalCount, pageCount, pageNum);
 	   for(let i=0;i<arrObj.length;i++){
 		   let obj = arrObj[i];
 		   let id = obj.id;
 		   let name = obj.name;
 		   let platform_name = obj.platform_name;
 		  if(platform_name ==null || platform_name==""){
 			 platform_name='空';
  	  		   }
 		   let production_count = obj.production_count;
 		  if(production_count ==null || production_count==""){
 			 production_count='0';
 	  		   }
 		  let focus_count = obj.focus_count;
 		 if(focus_count ==null || focus_count==""){
 			focus_count='0';
  		   }
 		   let reader_count = obj.reader_count;
 		   if(reader_count ==null || reader_count==""){
 			  reader_count=0;
 		   }
 		   let spider_level = obj.spider_level;
 		  if(spider_level ==null || spider_level==""){
 			 spider_level='空';
  		   }
 		  let home_page_url = obj.home_page_url;
 		   let certification_instructions = obj.certification_instructions;
 		  if(certification_instructions ==null || certification_instructions==""){
 			 certification_instructions='空';
 		   }
 		   let str0 = '<tr><td><a href="'+home_page_url+'" target="view_window">'+name+'</a></td><td>'+platform_name+'</td><td>'+
 		   production_count+'</td><td>'+focus_count+'</td><td>'+reader_count+'</td><td>'+
 		   spider_level+'</td><td>'+certification_instructions+'</td></tr>';
 		 
 			listStr1 += str0;
 			
 	   }
 	   $("#tbody").html(listStr1);
 }
    $(document).ready(function() {
        $('.footable').footable();
    });
    
    $(function(){
    	let pageCount = '${list.pages }';
    	if(pageCount>500){
    		pageCount = 500
    	}
		paging(1,pageCount,'${list.pageNum }');
	});
    
    function paging(totalData,totalPage, pagenum) {
		$('#box').paging({
			initPageNo : pagenum, // 初始页码
			totalPages : totalPage, //总页数
			totalCount : '合计' + totalData + '条数据', // 条目总数
			slideSpeed : 600, // 缓动速度 单位毫秒
			jump : true, //是否支持跳转
			callback : function(page) {
				// 回调函数
			}
		});
	}
    
    function JumpToPage(pagenum) {
/* 		window.location.href = "${pageContext.request.contextPath}/wemedialist/run?PageNo="+pagenum;
 */	
 		if(pagenum>500){
 			pagenum = 500;
 		}
 		seek(pagenum);
    }

		
		//跑马灯方法 
// 		 function init(){
// 			    //获取标题
// 			    var title=document.title;
// 			    //分割字符串--->字符数组
// 			    var arr=title.split("");
// 			    //删除第一个元素并返回该元素
// 			    var e=arr.shift();
// 			    //把一个对象添加到数组末尾
// 			    arr.push(e);
// 			    //把数组转换成字符串
// 			    var marquee=arr.join("");
// 			    //返回给浏览器
// 			    document.title=marquee;
// 			    //定时一直执行
// 			    window.setTimeout("init()",1000);
// 			}
// 			window.onload=init;
		 
		
    </script>

    <!-- FooTable -->


</body>

</html>
